package com.xmy.cultivate.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xmy.cultivate.entity.CourseSchedulingDetail;
import com.xmy.cultivate.entity.Grade;
import com.xmy.cultivate.entity.RecordCourse;
import com.xmy.cultivate.entity.RepairCourse;
import com.xmy.cultivate.entity.views.MelodyConfirm;
import com.xmy.cultivate.util.Result;
import org.apache.ibatis.annotations.Param;
import org.springframework.scheduling.annotation.Async;

import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 补课表 服务类
 * </p>
 *
 * @author Coly
 * @since 2023-03-07
 */
public interface IRepairCourseService extends IService<RepairCourse> {
    public abstract boolean insertTo(Long schedulingId,Long RecordCourseId,Integer repairType,Long repairId,Integer lessonNum);

    public abstract boolean insertIn(Long gradeId,Long teacherId, Long id, String schooleDate,String timeStart, String timeEnd,Integer repairType,Long repairId,Integer lessonNum);

    public abstract boolean existScheduling(Long schedulingId);

    public abstract boolean existClash(RecordCourse recordCourse , Date startTime , Date endTime,Integer courseType,Integer yearPart,Integer quarterNum) throws ParseException;

    @Async("onlineAsync")
    void melodyCourseForGradeBatch(Long schoolId, LocalDate outDate, LocalDate inDate, Integer lessonType, Integer type) throws ParseException;

    /**
     * 按班级调课
     * @param courseSchedulingDetail
     * @return
     * @throws ParseException
     */
    public abstract boolean melodyCourseForGrade(CourseSchedulingDetail courseSchedulingDetail) throws ParseException;

    /**
     * 删除按班级调课
     * @param
     * @return
     * @throws ParseException
     */
    public abstract boolean deleteMelodyCourseForGrade(Long id) throws ParseException;


    MelodyConfirm melodyCourseForStudentConfirm(RepairCourse repairCourse, Long adminId);

    MelodyConfirm melodyCourseForGradeConfirm(CourseSchedulingDetail inCourseSchedulingDetail, CourseSchedulingDetail outCourseSchedulingDetail, Long adminId) throws ParseException;

    public abstract boolean melodyCourseForStudent(RepairCourse repairCourse) throws ParseException;

    public abstract boolean consumeCoruse(RepairCourse repairCourse) throws ParseException;

    public abstract Long getClashCountForGrade(String startDateTime,String endDateTime,String schooDate,Long gradeId,Long id);


    Long getClashCountForStudent(String startDateTime, String endDateTime, Long studentId, Integer lessonType);

    public abstract IPage<RepairCourse> consumeCourseForStudentList(IPage<RecordCourse> page, Wrapper wrapper);

    public abstract IPage<RecordCourse> consumeCourseForStudentExcel(IPage<RecordCourse> page, Wrapper wrapper);


    public abstract IPage<RepairCourse> getTemporaryClass(IPage<RepairCourse> page, Wrapper wrapper);



}
